package cn.iocoder.yudao.module.wine.controller.app.supplyorderevaluate;

import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.*;
import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.module.wine.controller.app.supplyorderevaluate.vo.*;
import cn.iocoder.yudao.module.wine.service.supplyorderevaluate.SupplyOrderEvaluateService;

@Tag(name = "用户 APP - 订单评价")
@RestController
@RequestMapping("/wine/supply-order-evaluate")
@Validated
public class AppSupplyOrderEvaluateController {

    @Resource
    private SupplyOrderEvaluateService supplyOrderEvaluateService;

    @PostMapping("/create")
    @Operation(summary = "创建订单评价")
    public CommonResult<Long> createSupplyOrderEvaluate(@Valid @RequestBody AppSupplyOrderEvaluateSaveReqVO createReqVO) {
        return success(supplyOrderEvaluateService.createSupplyOrderEvaluate(createReqVO));
    }

//    @PutMapping("/update")
//    @Operation(summary = "更新订单评价")
//    public CommonResult<Boolean> updateSupplyOrderEvaluate(@Valid @RequestBody AppSupplyOrderEvaluateSaveReqVO updateReqVO) {
//        supplyOrderEvaluateService.updateSupplyOrderEvaluate(updateReqVO);
//        return success(true);
//    }

//    @DeleteMapping("/delete")
//    @Operation(summary = "删除订单评价")
//    @Parameter(name = "id", description = "编号", required = true)
//    public CommonResult<Boolean> deleteSupplyOrderEvaluate(@RequestParam("id") Long id) {
//        supplyOrderEvaluateService.deleteSupplyOrderEvaluate(id);
//        return success(true);
//    }

    @GetMapping("/get")
    @Operation(summary = "获得订单评价详情")
    @Parameter(name = "id", description = "编号", required = true, example = "评价信息id")
    public CommonResult<AppSupplyOrderEvaluateRespVO> getSupplyOrderEvaluate(@RequestParam("id") Long id) {
        AppSupplyOrderEvaluateRespVO info = supplyOrderEvaluateService.getSupplyOrderEvaluate(id);
        return success(info);
    }

    @GetMapping("/list")
    @Operation(summary = "获得订单评价列表")
    public CommonResult<List<AppSupplyOrderEvaluateRespVO>> getSupplyOrderEvaluateList(@Valid AppSupplyOrderEvaluateListReqVO listReqVO) {
        List<AppSupplyOrderEvaluateRespVO> list = supplyOrderEvaluateService.getSupplyOrderEvaluateList(listReqVO);
        return success(list);
    }

    @GetMapping("/supply-info-evaluate-list")
    @Operation(summary = "获得供求信息评价列表")
    public CommonResult<List<AppSupplyOrderEvaluateRespVO>> getSupplyInfoEvaluateList(@RequestParam("infoId") Long infoId) {
        List<AppSupplyOrderEvaluateRespVO> list = supplyOrderEvaluateService.getSupplyInfoEvaluateList(infoId);
        return success(list);
    }


    @GetMapping("/user-list")
    @Operation(summary = "获得用户订单评价列表")
    public CommonResult<List<AppSupplyOrderEvaluateRespVO>> getUserEvaluateList(@Valid @RequestParam("userId") Long userId) {
        List<AppSupplyOrderEvaluateRespVO> list = supplyOrderEvaluateService.getUserEvaluateList(userId);
        return success(list);
    }
}
